<template>
  <div class="app-container">
    <el-table v-loading="loading" :data="list" border>
      <el-table-column label="ID" prop="id" width="80" />
      <el-table-column label="操作模块" prop="title" width="150" />
      <el-table-column label="操作类型" prop="businessType" width="100">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_oper_type" :value="scope.row.businessType"/>
        </template>
      </el-table-column>
      <el-table-column label="操作人员" prop="operName" width="100" />
      <el-table-column label="请求方法" prop="method" width="150" />
      <el-table-column label="请求URL" prop="operUrl" />
      <el-table-column label="操作IP" prop="operIp" width="120" />
      <el-table-column label="操作时间" prop="operTime" width="160">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.operTime) }}</span>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script>
import { listOperAudit } from "@/api/system/audit";

export default {
  name: "OperAudit",
  dicts: ['sys_oper_type'],
  data() {
    return {
      loading: true,
      list: [],
      total: 0,
      queryParams: {
        pageNum: 1,
        pageSize: 10
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    getList() {
      this.loading = true;
      listOperAudit(this.queryParams).then(response => {
        this.list = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    }
  }
};
</script>
